﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Narwhunderful.Aphelia.Framework.UI.TransitionEffects
{

    public class TransitionSouth : TransitionEffect
    {

         public TransitionSouth(Game game)
            : base(game)
        {
            base.Interval = 1000;
        }

        protected override void UpdateTransitionOffsets()
        {
            base.TransitionOffset = (float)Math.Pow(base.Progress, 2);
            base.InvertedTransitionOffset = (float)Math.Pow((base.Progress - 1.0f) * -1, 2);
        }

        protected override void UpdateEffect(GameTime gameTime)
        {
            base.UpdateEffect(gameTime);
            if (base.IsTransitioningOn)
            {
                base.Location = new Vector2(0.0f, base.CurrentScreen.TransformedBounds.Height - base.CurrentScreen.TransformedBounds.Height * base.TransitionOffset);
                base.BasicEffect.Alpha = base.TransitionOffset;
            }
            if (base.IsTransitioningOff)
            {
                base.Location = new Vector2(0.0f, base.CurrentScreen.TransformedBounds.Height * base.TransitionOffset);
                base.BasicEffect.Alpha = base.InvertedTransitionOffset;
            }
        }

    }

}
